// pages/login/login.js
var App=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    title:"欢迎登陆",
    hidd1:1,
    hidd0:0,
    shoplist:[
      {
        id:"1",
        name:"yzy",
        sex:"boy"
      },{
        id:"2",
        name:"momo",
        sex:"girl"
      },{
        id:"3",
        name:"ll",
        sex:"girl"
      }
    ]
  },
  
  seqreq: function(){
    wx.request({
      url: 'http://localhost:8080/index',
      method: 'GET',
      header: {
        'content-type':'application/json'
      },
      data: {
        title:"hahahah"
      },
      success: function(data){
        console.log(data.data)
      },
    })
  },

  uname(e){
    console.log(e.detail)
  },

  pwd(e){
    console.log(e.detail)
  },
  btn:function(){
    console.log(uname)
  },
  loginForm: function(data) {
    console.log(data.detail.value)//  {username: "hgj", password: "fsdfsd"}
    var username = data.detail.value.username
    var password = data.detail.value.password;
    wx.request({
      url: 'http://localhost:8080/index',
      method: 'GET',
      header: {
        'content-type':'application/json'
      },
      data: {
        username:username,
        password:password
      },
      success: function(data){
        console.log(data.data)
        if(data.data.code==200){
          wx.navigateTo({
            url: '/pages/index/index',
          })
        }
      },
    })
  },
  

  btn:function(options){
    wx.navigateTo({
      url: '/pages/test/test'
    })
  },

  one:function(options){
    wx.navigateTo({
      url: '/pages/test/test',
    })
  },
  two:function(options){
    wx.navigateTo({
      url: '/pages/test/test2',
    })
  },
  three:function(options){
    wx.navigateTo({
      url: '/pages/test/test3',
    })
  },
  four:function(options){
    wx.navigateTo({
      url: '/pages/test/test4',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    // console.log(App)
    // console.log(App.globalData.userInfo.nickName)
    // this.setData({nickName:App.globalData.userInfo.nickName})
  },
  //  globalData:{
  //    nickName:null
  //  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})